package com.demo.springboot.web;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

@Controller
public class ViewController {
    @RequestMapping("/view/test")
    public String test(Model model) {
        //其他业务逻辑代码
        model.addAttribute("id", 1);
        return "demo";
    }

    @ResponseBody
    public String data() {
        return "view.data";
    }
}
